﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.Objects;
using System.Collections.Generic;

namespace POC
{
    public partial class _Default : System.Web.UI.Page
    {
        TreeEntities treeContext;
        X_HIERARCHIES hierarchies;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack == false)
            {
                //This is a simple ADO.NET Entity Framework query!
                //treeContext = new TreeEntities();
                //drpHierarchy.DataSource = treeContext.X_HIERARCHIES;
                //drpHierarchy.DataTextField = "HIER_NAME";
                //drpHierarchy.DataValueField = "HIERARCHY_ID";
                //drpHierarchy.DataBind();
            }
        }
        /*
        private void test()
        {
            //Declare the instances for the Entities and ObjectParameter collection
            {
                DemoDbEntities dEntity = new DemoDbEntities();
                List<ObjectParameter> ob = new List<ObjectParameter>();
                //Declare the query holder variable
                string dynStr = string.Empty;
                //Build the query based on the selected used inputs
                if (this.txtName.Text != string.Empty)
                {
                    dynStr += "it.Name =@Name";
                    //Add the object parameter into the collection
                    ob.Add(new ObjectParameter("Name", txtName.Text));
                }
                if (this.txtGuide.Text != string.Empty)
                {
                    dynStr = (dynStr.Length > 0 ? dynStr + " And " : dynStr);
                    dynStr += "it.GuideName =@guide";
                    ob.Add(new ObjectParameter("guide", txtGuide.Text));
                }
                if (this.txtModel.Text != string.Empty)
                {
                    dynStr = (dynStr.Length > 0 ? dynStr + " And " : dynStr);
                    dynStr += "it.Model =@Model";
                    ob.Add(new ObjectParameter("Model", txtModel.Text));
                }
                if (this.txtJourneyDate.Text != string.Empty)
                {
                    dynStr = (dynStr.Length > 0 ? dynStr + " And " : dynStr);
                    dynStr += "it.JourneyDate =@jrDate";
                    ob.Add(new ObjectParameter("jrDate", Convert.ToDateTime(txtJourneyDate.Text)));
                }
                if (this.chkBk.Checked)
                {
                    dynStr = (dynStr.Length > 0 ? dynStr + " And " : dynStr);
                    dynStr += "it.BookedLodge =@brlodge";
                    ob.Add(new ObjectParameter("brlodge", true));
                }
                if (this.chkFood.Checked)
                {
                    dynStr = (dynStr.Length > 0 ? dynStr + " And " : dynStr);
                    dynStr += "it.FoodBeverage =@fbr";
                    ob.Add(new ObjectParameter("fbr", true));
                }
                if (this.chkMobile.Checked)
                {
                    dynStr = (dynStr.Length > 0 ? dynStr + " And " : dynStr);
                    dynStr += "it.Mobile =@cmobile";
                    ob.Add(new ObjectParameter("cmobile", true));
                }
                dynamic qry = null;
                if (dynStr.Length > 0)
                {
                    if (dynStr.EndsWith("And"))
                    {
                        dynStr.Remove(dynStr.Length, -3);
                    }
                    //Executing the query for the where condition
                    qry = dEntity.TourChecklist.Where(dynStr, ob.ToArray());
                }
                else
                {
                    //Executes the whole resule
                    qry = dEntity.TourChecklist;
                }
                //Bind the Grid Control
                this.grdResults.DataSource = qry;
                this.grdResults.DataBind();
            }
        
        }*/
    }
}
